﻿using UnityEngine;
using System.Collections;

public class controlCamara : MonoBehaviour {
	public GameObject camara;
	public float Smooth=5;

	private int estadoCamara=1;
	//estadoCamara = 0 -> camara estatica
	//estadoCamara = 1 -> camara mov horizontal
	//estadoCamara = 2 -> camara mov vertical

	void cambiarEstado(int estado){
		estadoCamara=estado;
	}

	// Update is called once per frame
	void Update () {
		if(estadoCamara==1)
			movimientoCamaraHorizontal();
		if(estadoCamara==2)
			movimientoCamaraVertical();
	}

	void movimientoCamaraHorizontal(){
		Vector3 posIni= camara.transform.position;
		Vector3 posFin=new Vector3(transform.position.x,camara.transform.position.y,camara.transform.position.z);
		camara.transform.position = Vector3.Lerp(posIni,posFin,Smooth*Time.deltaTime);
	}

	void movimientoCamaraVertical(){
		Vector3 posIni= camara.transform.position;
		Vector3 posFin=new Vector3(camara.transform.position.x,transform.position.y,camara.transform.position.z);
		camara.transform.position = Vector3.Lerp(posIni,posFin,Smooth*Time.deltaTime);
	}
}
